package leetcode_201_300;

import com.sun.org.apache.xpath.internal.operations.And;

import java.util.Arrays;
import java.util.List;

public class LeeCode_260 {
    public static void main(String[] args) {

    }
    private static int[] singleNumber(int[] nums) {
        Arrays.sort(nums);
        int[] ans = new int[2];
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (i == 0 ){
                if(i + 1 < nums.length && nums[i] != nums[i + 1]){
                    ans[index] = nums[i];
                    index++;
                    continue;
                }
                continue;
            }
            if (i == nums.length - 1 && nums[i] != nums[i - 1]){
                ans[index] = nums[i];
                break;
            }
            if (nums[i] != nums[i - 1] && nums[i] != nums[i + 1]){
                ans[index] = nums[i];
                index++;
            }
        }
        return ans;
    }
}
